﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using ViewMaker;

namespace CloudStorageLight.WpfClient.Tests
{
    public class MyMainVM : MainVM
    {
        public Action<ViewModelBase> ShowDialogAction = null;
        public Func<bool> ShowErrorAction = null;

        public bool ReturnValueAsShowYesNo = true;

        public List<string> ShownMessages = new List<string>();

        public MyMainVM()
        {
        }

        protected override void ShowDialog(ViewMaker.ViewModelBase vm, string title = null)
        {
            if (ShowDialogAction != null) ShowDialogAction(vm);
        }

        protected override bool ShowOKCancel(string message, string title = "confirm")
        {
            ShownMessages.Add(message);
            return ReturnValueAsShowYesNo;
        }

        protected override bool ShowYesNo(string message, string title = "confirm")
        {
            ShownMessages.Add(message);
            return ReturnValueAsShowYesNo;
        }

        protected override MessageBoxResult ShowYesNoCancel(string message, string title = "confirm")
        {
            ShownMessages.Add(message);
            return ReturnValueAsShowYesNo ? MessageBoxResult.Yes : MessageBoxResult.No;
        }

        protected override bool ShowError(string message, bool systemError)
        {
            this.Message = message;
            if (ShowErrorAction != null) return ShowErrorAction();
            return false;
        }

        protected override string ShowFolderDailog()
        {
            return System.IO.Path.GetTempPath();
        }

    }

}
